From b175259586a64137ca5dc55a51181eb1abedd1fb Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 12 Apr 2010 17:45:26 +0100 Subject: [PATCH] libxl,xl: Fix two minor bugs in domain destruction * If /local/domain//device does not exist, this is not necessarily an error. It probably means the domain has been partially destroyed already. * Have xl report errors from libxl_domain_destroy. Signed-off-by: Ian Jackson --- tools/libxl/libxl_device.c | 2 +- tools/libxl/xl.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 9fdd0b477a..ca2008070d 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -301,7 +301,7 @@ int libxl_devices_destroy(struct libxl_ctx *ctx, uint32_t domid, int force) if (!l1) { XL_LOG(&clone, XL_LOG_ERROR, "%s is empty", path); libxl_ctx_free(&clone); - return -1; + return 0; } for (i = 0; i < num1; i++) { if (!strcmp("vfs", l1[i])) diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c index ccf012a08d..33329ca0c6 100644 --- a/tools/libxl/xl.c +++ b/tools/libxl/xl.c @@ -1277,8 +1277,10 @@ void unpause_domain(char *p) void destroy_domain(char *p) { + int rc; find_domain(p); - libxl_domain_destroy(&ctx, domid, 0); + rc = libxl_domain_destroy(&ctx, domid, 0); + if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n.",rc); exit(-1); } } void list_domains(int verbose) -- 2.30.2